package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.dao.LogMapper;
import com.itheima.po.PageVO;
import com.itheima.pojo.Log;
import com.itheima.pojo.Result;
import com.itheima.service.LogService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {
    @Resource
    LogMapper logMapper;

    @Override
    public Result getAll(Integer page, Integer pageSize) {
        Page<Object> help = PageHelper.startPage(page, pageSize);
        List<Log> all = logMapper.getAll();
        PageVO<Log> pageVO =new PageVO<>();
        pageVO.setTotal(help.getTotal());
        pageVO.setRows(all);
        return Result.success(pageVO);
    }
}
